﻿using System;
using System.Drawing;

using SdlDotNet.Core;
using SdlDotNet.Input;
using SdlDotNet.Graphics;
using SdlDotNet.Graphics.Sprites;


namespace SDLTest
{
    class PSprite: AnimatedSprite
    {
        private int vx= 0, vy = 0;
        
        private bool disposed = false;
        private Rectangle bounds;

        public void UpArrow() {
            vy -= 1;
        }
        public void LeftArrow() {
            vx -= 1;
        }
        public void RightArrow() {
            vx += 1;
        }
        public void DownArrow() {
            vy += 1;
        }
        public PSprite(SurfaceCollection sc, Point coordinates):base(sc,coordinates) {
            this.Animate = true;
            this.AllowDrag = true;

        }

        public override void Update(TickEventArgs args)
        {
            base.Update(args);
            // Cambiamos el valor de donde se dibuja:
            X = X + vx;
                
            Y = Y + vy;
        }
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!this.disposed)
                {
                    if (disposing)
                    {
                    }
                    this.disposed = true;
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
        public void SetVx(int vx) { this.vx = vx; }
        public void SetVy(int vy) { this.vy = vy; }
        public int GetVx() { return vx; }
        public int GetVy() { return vy; }
    }
}
